package cn.zktr.Personnel.controllers.zhouxiong;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.zktr.Personnel.model.pojos.*;
import cn.zktr.Personnel.model.service.zhouxiong.*;
import cn.zktr.Personnel.model.service.zhouyongcong.*;

@Controller
public class KaoQinController {

	@Autowired
	private getUitlsService gus;
	@Autowired
	private KaoQinKaService kqk;
	@Autowired
	private JiChuService jichu;

	@RequestMapping("zx/kao-qin-ka")
	public void zhujiemian(Model model) {}
	
	@RequestMapping("KaoQin")
	@ResponseBody
	public Map<String,Object> kaoqin(int page,int rows) {
		Map<String,Object> map = new HashMap<>();
		map.put("total",kqk.seleKaoQinKa().size());
		Page<Object> p=PageHelper.startPage(page,rows);
		JSONArray findAll=kqk.seleKaoQinKa();
		//页内容
		map.put("rows",findAll);
		return map;
	}
	
	@RequestMapping("KaoQinRenYuan")
	@ResponseBody
	public Map<String,Object> kaoqin(Integer CWASID,int page,int rows) {
		Map<String,Object> map = new HashMap<>();
		map.put("total",kqk.KaoQinRenYuan(CWASID).size());
		Page<Object> p=PageHelper.startPage(page,rows);
		JSONArray findAll=kqk.KaoQinRenYuan(CWASID);
		//页内容
		map.put("rows",findAll);
		return map;
	}
	
	@PostMapping("updateKQK")
	@ResponseBody
	public String updateKQ(Integer cwasid,Integer temid,Integer shfid,Integer empid,Integer rsnid,String cwasrem,Model model) {
		kqk.addKaoQinKa( cwasid, temid, shfid, empid, rsnid, cwasrem);
		return "";
	}
	
	/**原因
	 * @return
	 */
	@RequestMapping("YuanYin")
	@ResponseBody
	public JSONArray yuanyin() {
		return jichu.seleYuanYin();
	}
	
	/**考勤部门
	 * @return
	 */
	@RequestMapping("KaoQinDept")
	@ResponseBody
	public JSONArray KaoQinDept() {
		return kqk.selectDept();
	}
	
	/**考勤卡
	 * @return
	 */
	@RequestMapping("KaoQinKa")
	@ResponseBody
	public JSONArray KaoQinKa() {
		return kqk.seleKaoQinKa();
	}
	
	/**排班
	 * @return
	 */
	@RequestMapping("PaiBancsh")
	@ResponseBody
	public JSONArray PaiBan() {
		return kqk.selePaiBan();
	}
	
	/**班次
	 * @return
	 */
	@RequestMapping("BanCi")
	@ResponseBody
	public JSONArray BanCi() {
		return jichu.selectBanCi();
	}
	
	/**班组
	 * @return
	 */
	@RequestMapping("BanZucsh")
	@ResponseBody
	public JSONArray BanZu() {
		return jichu.selectBanZu();
	}
	
	/**请假种类
	 * @return
	 */
	@RequestMapping("QinJiaZhongLeicsh")
	@ResponseBody
	public JSONArray QinJiaZhongLei() {
		return jichu.seleQinJiaZhongLei();
	}
	
}
